package library

import (
	"github.com/gin-gonic/gin"
	"net/http"
)

func Response(c *gin.Context, httpCode int, status bool, msg string, data gin.H) {
	c.JSON(httpCode, gin.H{
		"status": status,
		"msg":    msg,
		"data":   data,
	})
}

func Success(c *gin.Context, msg string, data gin.H) {
	Response(c, http.StatusOK, true, msg, data)
}

func Fail(c *gin.Context, msg string) {
	Response(c, http.StatusOK, false, msg, nil)
}
